#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+2;
int n,a[maxn];
int ans;
inline int read(){
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        s=s*10+ch-'0';
        ch=getchar();
    }
    return s*f;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(int i=1;i<=n;i++){
        a[i]=read();
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)
        cout<<a[i]<<" ";
    int l=1,r=n;
    while(l<r){
        int mid=l+r>>1;
        if(a[l]<a[r]){
            ans++;
        }
        l++,r--;
    }
    if(n&1)ans++;
    printf("%d\n",n-ans);
    return 0;
}
